<?php 
class Profile extends Object
{
	public $Username;
	public $Email;
	public $Image;
	public $ImageObject;
	
	public $Level;
	public $Group;
	
	public $RegisterDate;
	public $LastvisitDate;
	
	public $PartnerStatus;
	public $PartnerStatusDateStart;
	public $PartnerTypes;
	
	public $Name;
	public $Lastname;
	public $Company;
	public $Company_id;
	public $Gender;
	public $Bdate;
	public $Country;
	public $CountryName;
	public $State;

	public $City;
	public $Zip;
	public $Address;
	public $Address2;
	public $Phone;
	public $Fax;
	public $Mob;
	public $Www;
	
	public $Valid_customer;
	public $Online_time;

	public $AlternateDelivery;
	public $DeliveryName;
	public $DeliveryLastName;
	public $DeliveryAddress;
	public $DeliveryAddress2;
	public $DeliveryZip;
	public $DeliveryCity;
	public $DeliveryCountry;
	
	public $ProfilePage;
	
	public function getWww()
	{
		if($this->Www != '')
		{
			if(!(substr_count($this->Www, 'http://') > 0))
			{ $this->Www = 'http://'.$this->Www; }
			return $this->Www;
		}
		else
		{ return $this->Www; }
	}
	
	public function getZip($minLen=0) 
	{ 
		if($minLen > 0)
		{
			if(strlen($this->Zip) >= $minLen)
			{ return $this->Zip; }
			else
			{
				$newZip = $this->Zip;
				$nowlen = strlen($newZip);
				while($nowlen < $minLen)
				{
					$newZip = '0'.$newZip;
					$nowlen = strlen($newZip);
				}
				return $newZip;
			}
		}
		else
		{ return $this->Zip; }
	}
	
	public function Profile($values = Array())
	{ 
		self::setDataTable('user_details');
		if(count($values) > 0)
		{ self::setValues($values); }
	}
	
	public function __toString()
	{
		$out .= self::getId().', ';
		$out .= self::getCompany().', ';
		return $out;
	}
	
	public function getLink()
	{ return '/profile/'.self::getId().'/'; }
	
	public function loadMetaData()
	{
		global $katana;
		
		$katana->setDetailView(true);
		$katana->setMetaTitle(self::getCompany());
		$katana->addAfterMetaTitle($katana->getTitle());
		
		$katana->setMetaData($katana->getTitle());
		$katana->addBeforeMetaData(self::getCompany());
		
		$katana->setMetaKey($katana->getTitle());
		$katana->addBeforeMetaKey(self::getCompany());
	}
}
?>